<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>卡片翻动</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            font-size: 5em;
            color: #333;
        }

        .container {
            width: 100vw;
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: #393942;
        }

        .card-container {
            width: 100px;
            background: #d7d7d7;
            position: relative;
            height: 100px;
            text-align: center;
        }

        .card-container::before {
            content: '';
            width: 100%;
            position: absolute;
            left: 0;
            top: 50%;
            height: 2px;
            background: linear-gradient(to bottom, #000, #000 1px, #fff 1px);
            z-index: 99;
            margin-top: -1px;
        }

        .card {
            position: absolute;
            width: 100%;
            height: 50%;
            left: 0;
            top: 0;
            overflow: hidden;
            /*隐藏元素背面*/
            backface-visibility: hidden;
            transition: 0.5s;
        }

        .card1 {
            background-color: #2da0d6;
            line-height: 100px;
        }

        .card3 {
            background-color: #ff5a00;
            line-height: 100px;
            transform-origin: center bottom;
        }

        .card2 {
            background-color: #25ff6b;
            line-height: 0;
            top: 50%;
            transform: rotateX(180deg);
            transform-origin: center top;
            z-index: 10;
        }

        .card4 {
            background-color: #ff0027;
            line-height: 0;
            top: 50%;
        }

        .card-container:hover .card2 {
            transform: rotateX(0deg);
        }

        .card-container:hover .card3 {
            transform: rotateX(-180deg);
        }
    </style>
</head>
<body>
<div class="container">
    <div class="card-container">
        <div class="card card1">7</div>
        <div class="card card2">7</div>
        <div class="card card3">8</div>
        <div class="card card4">8</div>
    </div>
</div>
</body>
</html>